import random

ran = random.random()
print(ran)

ran = random.randrange(1, 10, 2)
print(ran)

list1 = [2, 4, 1]
ran = random.choice(list1)
print(ran)

random.shuffle(list1)
print(list1)


# 验证码 大小写字母与数字组合
def generator(num):
    code = []
    for i in range(num):
        ran1 = str(random.randint(0, 9))
        ran2 = chr(random.randint(65, 90))
        ran3 = chr(random.randint(97, 122))

        res = random.choice([ran1, ran2, ran3])
        code.append(res)

    return "".join(code)


res = generator(5)
print(res)
